#!/bin/bash

source $DRAW_INI
source $DRAW_CFG

java -Xmx4g -jar $GATK \
  -T VariantFiltration \
  -R $REF_FASTA \
  -et NO_ET \
  --variant:VCF ${2}/${1}.vcf \
  --mask ${2}/${1}_indel.vcf \
  --maskName NearIndel \
  -l INFO \
  --clusterWindowSize 10 \
  --filterName "HomopolymerRun"  --filterExpression "HRun>=4" \
  --filterName "QualByDepth"     --filterExpression "QD<5.0" \
  --filterName "StrandBias"      --filterExpression "FS>=20.0" \
  -o ${2}/${1}_filtered.vcf 

EXITSTATUS=$?


if [ ! -s "${2}/${1}_filtered.vcf" ]; then exit 100;fi;

exit $EXITSTATUS
